Skip to content

Show ramp crypto amounts at the asset's own decimal precision - #6168

Merged
j0ntz merged 1 commit into
developfrom
jon/moonpay-decimal-precision
Sep 28, 2026
Merged

j0ntz merged 1 commit into
developfrom
jon/moonpay-decimal-precision

Conversation

@j0ntz

@j0ntz j0ntz commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Description

Asana: https://app.asana.com/0/1215088146871429/1217660195990065

MoonPay told us it raises the decimal precision of its buy flow on
September 1, 2026. BTC goes from 5 to 8 decimals, ETH from 6 to 9 decimals, and
SOL from 3 to 9 decimals, while stablecoins stay at 2. MoonPay asked integrators to confirm they treat crypto
amounts as variable-precision decimals rather than assuming a fixed count per
asset. The sell flow is unaffected.

Audit of the live buy path (src/plugins/ramps/moonpay/, which is what the Buy
tab routes to; the legacy amountQuotePlugin sits behind pluginListBuyOld):

  • Parsing and maths are already variable-precision. The quote amount is a JSON
    number rendered back through Number.toString() and then handled by
    biggystring, which is arbitrary precision and accepts exponent notation.
  • Nothing in the buy path stores or reconciles the amount at a fixed scale, and
    the one quote-vs-delivered comparison normalises both sides through the same
    number parse, so it assumes no decimal count.
  • One place did hardcode a decimal count: RampCreateScene rendered the crypto
    amount field with maxDecimals={6}, which FilledTextInput applies as
    toFixed(value, 0, 6), a truncation. Every MoonPay asset currently quotes at
    6 decimals or fewer, so the cap has never bitten; after September 1 it would
    silently drop 2 digits of BTC and 3 of ETH and SOL.

This derives the cap from the selected asset's own denomination instead, bounded
at 9 decimals. That gives BTC 8, ETH 9, SOL 9 and USDC 6, matching MoonPay's new
per-asset maximums. The bound matters for assets with more precision than a
quote can carry: when the user types a fiat amount the field divides by a float
exchange rate, whose rounding noise shows up past about 9 decimals, so rendering
ETH's full 18 would surface digits that are not real.

Verified on the iOS simulator with a before and after pair on the same input,
attached below. verify-repo.sh passes (eslint, jest, changelog).


Note

Low Risk
Localized change to ramp amount input formatting; quote handling was already variable-precision and only the entry field was truncated at six decimals.

Overview
Buy/sell ramp crypto amount entry no longer hard-caps display and typing at six decimals. The field now uses cryptoMaxDecimals, derived from the selected asset’s denomination precision via mulToPrecision, capped at nine so high-precision assets (e.g. ETH) don’t show spurious digits when fiat-driven amounts are divided by a float exchange rate.

This aligns the UI with provider quote precision (e.g. MoonPay’s per-asset limits for BTC/ETH/SOL) without changing how quotes are parsed or calculated elsewhere.

Reviewed by Cursor Bugbot for commit fa6dab9. Bugbot is set up for automated code reviews on this repo. Configure here.

@j0ntz

j0ntz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

📸 Test evidence

before truncated at 6 decimals

before truncated at 6 decimals

after btc shows 8 decimals

after btc shows 8 decimals

after eth shows 9 decimals

after eth shows 9 decimals

Captured by the agent's in-app test run (build-and-test).

@j0ntz
j0ntz marked this pull request as ready for review August 19, 2026 23:44
@j0ntz
j0ntz force-pushed the jon/moonpay-decimal-precision branch from 7d5423a to e85b6b3 Compare August 19, 2026 23:44
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

The buy/sell amount field capped the crypto value at six decimals, which
was fine while every provider quoted at or below that. MoonPay raises its
buy-flow precision on September 1, 2026 (BTC to eight decimals, ETH and
SOL to nine), so the cap would start silently truncating the amount the
user is quoted.

Derive the cap from the selected asset's denomination instead, bounded at
nine decimals. Assets with more precision than a quote can express, such
as ETH at eighteen, would otherwise surface the rounding noise of the
float exchange rate the field divides by while a fiat amount is typed.
@j0ntz
j0ntz force-pushed the jon/moonpay-decimal-precision branch from e85b6b3 to fa6dab9 Compare September 28, 2026 19:19
@j0ntz
j0ntz enabled auto-merge September 28, 2026 19:19
@j0ntz

j0ntz commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Landing this without a review.

  • Rationale: a one-line display cap change in the ramp amount field (six to up to nine decimals), verified on the iOS sim with a before/after pair
  • Authority: Force Land = Land Approved on the linked Asana task (1217660195990065)
  • Bypassed: the approving-review requirement only. Every required check is green on fa6dab9f744077b256e9571b37d1f3fc5fb73aa9.

@j0ntz
j0ntz merged commit 0e830e6 into develop Sep 28, 2026
7 checks passed
@j0ntz
j0ntz deleted the jon/moonpay-decimal-precision branch September 28, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant